#ifndef BOSS_Afterburner_Particle_H
#define BOSS_Afterburner_Particle_H

#include "TDatabasePDG.h"
#include "TParticlePDG.h"
#include "TString.h"
#include <yaml-cpp/yaml.h>

/// @addtogroup Afterburner_objects
/// @{

/// Container for particle data. In essence an extended container of `ROOT`'s
/// [`TParticlePDG`](https://root.cern.ch/doc/master/classTParticlePDG.html). This object describes fundamental properties of a particle. Most of this information is accessed through a reference to its equivalent `TParticlePDG` in the `TDatabasePDG`. The rest is additional information, like a LaTeX formated string that gives the sign for the particle.
/// @author   Remco de Boer 雷穆克 (r.e.deboer@students.uu.nl or remco.de.boer@ihep.ac.cn)
/// @date     November 16th, 2018
class Particle
{
public:
  Particle() {}
  Particle(int pdgCode);
  Particle(const TString& input);
  Particle(const YAML::Node& input);
  bool IsLoaded() const;

  TParticlePDG* ParticlePDG() const { return fParticlePDG; }
  int           PDGCode() const;
  double        Mass() const;
  const char*   NameLaTeX() const;
  const char*   Name() const;

protected:
  TParticlePDG* fParticlePDG;
  TString       fParticleNameLaTeX; ///< Particle name in LaTeX format.

  inline static const TDatabasePDG gPDG;

  void     Initialize();
  TString& DetermineNameLaTeX();
};

/// @}

namespace BOSS_Afterburner
{
  namespace Particles
  {
    inline const Particle Em{11};    ///< Electron           (\f$ e^- \f$).
    inline const Particle Mum{13};   ///< Muon               (\f$ \mu^- \f$).
    inline const Particle Pip{211};  ///< Positive pion      (\f$ \pi^+ \f$).
    inline const Particle Pi0{111};  ///< Neutral pion       (\f$ \pi^0 \f$).
    inline const Particle Rhop{213}; ///< Positive rho meson (\f$ \rho^\pm \f$).
    inline const Particle Rho0{113}; ///< Neutral rho meson  (\f$ \rho^0 \f$).
    inline const Particle K{321};    ///< Positive kaon      (\f$ K^\pm \f$).
    inline const Particle K0{311};   ///< Neutral kaon       (\f$ K^\pm \f$).
    inline const Particle Phi{333};  ///< Phi meson          (\f$ \phi \f$).
    inline const Particle D0{421};   ///< Neutral D meson    (\f$ D^0 \f$).
    inline const Particle P{2212};   ///< Proton             (\f$ p \f$).
  }                                  // namespace Particles
} // namespace BOSS_Afterburner
#endif